<template>
  <div class="user">
      <ul class="menu">
          <li> <router-link to="/user/info">我的资料</router-link></li>
          <li> <router-link to="/user/order">我的订单</router-link></li>

      </ul>
      <div class="main">
          <div class="pos">
              <span>{{ username }}，欢迎您！<button @click="quit">退出</button></span>
              <p>当前位置:
                <router-link to="/">首页&gt;</router-link>
                <router-link  :to="item.path" v-for="(item,index) in $route.matched" :key="index">{{ item.meta.title }}
                  <span v-if="index!==$route.matched.length-1">&gt;</span>
                </router-link>

              </p>
          </div>
          <div class="content">
              <!-- 二级路由出口 -->
              <router-view></router-view>
          </div>
      </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      username: localStorage.getItem('superMagic')
    }
  },
  methods: {
    quit () {
      localStorage.removeItem('superMagic')
      this.$router.push('/')
    }
  }
}
</script>

<style scoped>

</style>
